package site.shenjie.eureka.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * 沈杰
 * 2020-7-23 09:03:03
 * Security配置类：
 * 为eureka的web管理端添加安全登录
 */
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity httpSecurity) throws Exception {
        // 关闭csrf
        httpSecurity.csrf().disable();
        // 支持httpBasic
        httpSecurity.authorizeRequests().anyRequest().authenticated().and().httpBasic();
    }
}
